﻿using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;

namespace Bit.Art.Db.Data.Migrations.ExchangeDbContext
{
    public partial class v1 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "AccountBalances",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    AccountId = table.Column<uint>(nullable: false),
                    Address = table.Column<string>(maxLength: 64, nullable: true),
                    Balance = table.Column<decimal>(type: "decimal(18, 8)", nullable: false),
                    Currency = table.Column<string>(maxLength: 10, nullable: true),
                    Pending = table.Column<decimal>(type: "decimal(18, 8)", nullable: false),
                    Tag = table.Column<string>(maxLength: 64, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AccountBalances", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "DepositHistory",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Amount = table.Column<decimal>(type: "decimal(18, 8)", nullable: false),
                    Coin = table.Column<string>(maxLength: 10, nullable: true),
                    CreatedBy = table.Column<string>(maxLength: 30, nullable: false),
                    CreatedDate = table.Column<DateTime>(nullable: false),
                    Description = table.Column<string>(maxLength: 200, nullable: true),
                    Tag = table.Column<string>(maxLength: 64, nullable: true),
                    TxId = table.Column<string>(maxLength: 100, nullable: false),
                    UserId = table.Column<uint>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DepositHistory", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Orders",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    IsCancelled = table.Column<bool>(nullable: false),
                    LockedBalance = table.Column<decimal>(type: "decimal(18, 8)", nullable: false),
                    Market = table.Column<string>(maxLength: 20, nullable: true),
                    OrderType = table.Column<uint>(nullable: false),
                    PlacedDate = table.Column<DateTime>(nullable: false),
                    Price = table.Column<decimal>(type: "decimal(16, 8)", nullable: true),
                    QuoteVolume = table.Column<decimal>(type: "decimal(18, 8)", nullable: false),
                    QuoteVolumeDealed = table.Column<decimal>(type: "decimal(18, 8)", nullable: false),
                    Side = table.Column<uint>(nullable: false),
                    Taker = table.Column<bool>(nullable: false),
                    UserId = table.Column<uint>(nullable: false),
                    VipLevel = table.Column<uint>(nullable: false),
                    Volume = table.Column<decimal>(type: "decimal(18, 8)", nullable: false),
                    VolumeRemaining = table.Column<decimal>(type: "decimal(18, 8)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Orders", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "WithdrawRequests",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Amount = table.Column<decimal>(type: "decimal(18, 8)", nullable: false),
                    Coin = table.Column<string>(maxLength: 10, nullable: false),
                    CreatedDate = table.Column<DateTime>(nullable: false),
                    Description = table.Column<string>(maxLength: 200, nullable: true),
                    LastModified = table.Column<DateTime>(nullable: false),
                    LastModifiedBy = table.Column<string>(maxLength: 30, nullable: true),
                    Status = table.Column<int>(nullable: false),
                    TxId = table.Column<string>(maxLength: 100, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WithdrawRequests", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AccountBalances");

            migrationBuilder.DropTable(
                name: "DepositHistory");

            migrationBuilder.DropTable(
                name: "Orders");

            migrationBuilder.DropTable(
                name: "WithdrawRequests");
        }
    }
}
